## Decoding trials of RS[26,16,11]


from PyM import *



# # Replaces the non-zero field elements by their logs with respect
# # to a primitive root according to a precomputed table E. 
# # Conventionally, 0 is represented by null string ''
# def shorthand(X,E):
#     if isinstance(X,Vector_type):
#         return [lookup(x) for x in X]
#     if isinstance(X,Matrix_type):
#         S = []
#         for x in X:
#             r =[]
#             for a in x:
#                 r += [lookup(a,E)]
#             S+=[r]
#         return S
#     return lookup(X,E)
    

K = Zn(3)
(F,t) = extension(K,[1,0,-1,1],'t')

# t is a primitive root
show(order(t))

E = index_table(t)

C = PRS(F,16)


show(shorthand(decoder_trial(C,3),E))

show(shorthand(decoder_trial(C,5),E))

show(shorthand(decoder_trial(C,6),E))








